﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web.filehandle
{
    public partial class commentreply1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            YXShop.BLL.Accessories.CommentReply bll = new YXShop.BLL.Accessories.CommentReply();
            YXShop.Model.Accessories.CommentReply model = new YXShop.Model.Accessories.CommentReply();
            if (ChangeHope.WebPage.PageRequest.GetFormString("txtReplyContent") == "")
            {
                ChangeHope.WebPage.Script.AlertAndGoBack("回复内容不能为空！");
                return;
            }
            int UID = 0;
            if (Session["MemberID"] != null)
            {
                UID = Convert.ToInt32(Session["MemberID"].ToString());
            }
            string CommentID = ChangeHope.WebPage.PageRequest.GetQueryString("q_commentid");
            if (CommentID != "")
            {
                model.UID = UID;
                model.CommentID =Convert.ToInt16(CommentID);
                model.Content = ChangeHope.WebPage.PageRequest.GetFormString("txtReplyContent");
                model.ReplyTime = System.DateTime.Now;
                if (bll.Add(model) != 0)
                {
                    
                    ChangeHope.WebPage.Script.AlertAndRedirect("回复成功！",Request.UrlReferrer.ToString());
                    return;
                }
            }
            else
            {
                ChangeHope.WebPage.Script.AlertAndGoBack("回复失败！");
                return;
            }
        }
    }
}
